//
//  HYDatabaseManager.h
//  airpop
//
//  Created by yan on 2016/11/29.
//  Copyright © 2016年 aetheris. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <FMDB.h>

@interface HYDatabaseManager : NSObject

@property (nonatomic, strong, readonly) dispatch_queue_t queue;
@property (nonatomic, copy) NSString *path;

+ (HYDatabaseManager *)shareInstance;

+ (void)executeSql:(NSString *)sql finished:(void (^) (BOOL result))finished; //  finished block if is not care set nil.
+ (void)executeSqls:(NSArray<NSString *> *)sqls finished:(void (^) (BOOL result))finished;
/**
 select
 
 @param sql sql string
 @param keys @[
 @{@"type":@(FMResultType), @"name":@"age"},
 @{@"type":@(FMResultType), @"name":@"name"},
 @{@"type":@(FMResultType), @"name":@"gender"},
 ]
 @param finished results dictionarys
 */
+ (void)selectSql:(NSString *)sql keys:(NSArray<NSString *> *)keys finished:(void (^) (NSArray *results))finished;

/**
 select
 
 @param sql sql string
 @param cla model class
 @param keys @[
 @{@"type":@(FMResultType), @"name":@"age"},
 @{@"type":@(FMResultType), @"name":@"name"},
 @{@"type":@(FMResultType), @"name":@"gender"},
 ]
 @param finished results class models
 */
+ (void)selectSql:(NSString *)sql class:(Class)cla keys:(NSArray<NSString *> *)keys finished:(void (^) (NSArray *results))finished;

@end
